package com.rankeiot.platform.service;

import org.sagacity.sqltoy.SqlToyContext;
import org.sagacity.sqltoy.plugins.id.IdGenerator;

import java.util.Date;

public class CodeIdGenerator implements IdGenerator {
    private CodesService codesService;
    @Override
    public Object getId(String tableName, String signature, String[] relatedColumns, Object[] relatedColValue, Date bizDate, String idJavaType, int length, int sequencSize) {
        return codesService.getCode(signature);
    }
    public void initialize(SqlToyContext sqlToyContext) throws Exception {
        this.codesService=sqlToyContext.getAppContext().getBean(CodesService.class);
    }
}
